function [predictedClasses, continuousClasses, onlineError] = SegmentClassExpGradient( TrainingData, Data, class, printVRML, showCharts)
    VEG = 1004;
    WIRE = 1100;
    POLE = 1103;
    GROUND = 1200;
    FACADE = 1400;
    
    if(isempty(TrainingData))
        if(class == VEG)
            TrainingData =  SelectData(Data(randperm(size(Data,1)),:), [800; 200; 200; 200; 200]);
        elseif (class == WIRE)
            TrainingData  = SelectData(Data(randperm(size(Data,1)),:), [200; 800; 200; 200; 200]);
        elseif (class == POLE)
            TrainingData  = SelectData(Data(randperm(size(Data,1)),:), [200; 200; 800; 200; 200]);
        elseif (class == GROUND)
            TrainingData  = SelectData(Data(randperm(size(Data,1)),:), [200; 200; 200; 800; 200]);
        elseif (class == FACADE)
            TrainingData  = SelectData(Data(randperm(size(Data,1)),:), [200; 200; 200; 200; 800]);
        end
    end
    
    'Doing gradient descent on training data'
    [p, c, w,e, onlineError] = ExponentialGradientDescent(TrainingData , class);
    
    if(printVRML)
        'Printing VRML'
        PrintVRML('exponential_gradient_training.wrl', TrainingData, p);
    end
    
    if(showCharts)
        figure(1);
        plot(c, 'x');
    end

    'Doing prediction on actual data'
    [p, c, e, a]= PredictLinearClassification(w, Data, class);
    
    if(showCharts)
        figure(2);
        plot(c, 'x');
        hold on;
        plot(a, 'rx');
    end
    
    if(printVRML)
        'Printing VRML'
        PrintVRML('exponential_gradient_full.wrl', Data, p);
    end
    
    predictedClasses = p;
    continuousClasses = c;

end

